package group.base.controller;


import group.base.service.UserService;
import group.base.entity.User;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;;

import java.util.List;

@Controller
public class HelloController {
    private static Logger logger = Logger.getLogger(HelloController.class);

    @Autowired
    private UserService userService;

    @RequestMapping("/hello")
    public String test(){
        return "hello";
    }

    @RequestMapping("/user")
    @ResponseBody
    public List<User> getUserList(){
        List<User> userList = null;
        try{
            userList = userService.getUserList();
        }catch (Exception e){
            e.printStackTrace();
        }
        return userList;
    }
}
